package com.whut.model;

import javax.persistence.criteria.CriteriaBuilder;
import java.text.DecimalFormat;
import java.util.List;

public class Equipscore {
    private Integer mkey;

    private Integer projectId;

    private Integer checkId;

    private String projectName;

    private Integer equipType;

    private String equipNum;

    private Float equipScore;

    private Float risk0Point;

    private Float risk1Point;

    private Float risk2Point;

    private Float risk3Point;

    private Float risk4Point;

    private Integer risk1Num;

    private Integer risk2Num;

    private Integer risk3Num;

    private Integer risk4Num;

    public Integer getMkey() {
        return mkey;
    }

    public void setMkey(Integer mkey) {
        this.mkey = mkey;
    }

    public Integer getProjectId() {
        return projectId;
    }

    public void setProjectId(Integer projectId) {
        this.projectId = projectId;
    }

    public Integer getCheckId() {
        return checkId;
    }

    public void setCheckId(Integer checkId) {
        this.checkId = checkId;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName == null ? null : projectName.trim();
    }

    public Integer getEquipType() {
        return equipType;
    }

    public void setEquipType(Integer equipType) {
        this.equipType = equipType;
    }

    public String getEquipNum() {
        return equipNum;
    }

    public void setEquipNum(String equipNum) {
        this.equipNum = equipNum == null ? null : equipNum.trim();
    }

    public Float getEquipScore() {
        return equipScore;
    }

    public void setEquipScore(Float equipScore) {
        this.equipScore = equipScore;
    }

    public Float getRisk0Point() {
        return risk0Point;
    }

    public void setRisk0Point(Float risk0Point) {
        this.risk0Point = risk0Point;
    }

    public Float getRisk1Point() {
        return risk1Point;
    }

    public void setRisk1Point(Float risk1Point) {
        this.risk1Point = risk1Point;
    }

    public Float getRisk2Point() {
        return risk2Point;
    }

    public void setRisk2Point(Float risk2Point) {
        this.risk2Point = risk2Point;
    }

    public Float getRisk3Point() {
        return risk3Point;
    }

    public void setRisk3Point(Float risk3Point) {
        this.risk3Point = risk3Point;
    }

    public Float getRisk4Point() {
        return risk4Point;
    }

    public void setRisk4Point(Float risk4Point) {
        this.risk4Point = risk4Point;
    }

    public Integer getRisk1Num()  {return risk1Num;}

    public Integer getRisk2Num()  {return risk2Num;}

    public Integer getRisk3Num()  {return risk3Num;}

    public Integer getRisk4Num()  {return risk4Num;}

    /**
     * Author:yjh
     * Description:类中数据的插入与更新，
     * Create date:2021/3/9 21:00
     * Param:[Integer projectId, Integer checkId, String projectName,
     *        String equipType, String equipNum, String riskPoint,
     *        Integer problemNum, Double equipScore, Double risk0Point,
     *        Double risk1Point, Double risk2Point, Double risk3Point,
     *        Double risk4Point]
     * Return:void
     * Modify[]:,,
     */
    public void setInfo(Integer projectId, Integer checkId, String projectName,
                              Integer equipType, String equipNum, Float equipScore,
                        Float risk0Point, Float risk1Point, Float risk2Point,
                        Float risk3Point, Float risk4Point){
            try{
                this.projectId = projectId;
                this.checkId = checkId;
                this.projectName = projectName;
                this.equipType = equipType;
                this.equipNum = equipNum;
                this.equipScore = equipScore;
                this.risk0Point = risk0Point;
                this.risk1Point = risk1Point;
                this.risk2Point = risk2Point;
                this.risk3Point = risk3Point;
                this.risk4Point = risk4Point;
            }catch (Exception e){
                e.printStackTrace();
            }
    }
    /**
     * Author:yjh
     * Description:类中数据的插入与更新的方法setAllInfo()重载
     * Create date:2021/3/9 21:01
     * Param:[Integer projectId, Integer checkId, String projectName,
     *        String equipType, String equipNum, String riskPoint]
     * Return:void
     * Modify[]:,,
     */
    public void setAllInfo(Integer projectId, Integer checkId, String projectName,
                              Integer equipType, String equipNum){
        try{
            this.projectId = projectId;
            this.checkId = checkId;
            this.projectName = projectName;
            this.equipType = equipType;
            this.equipNum = equipNum;
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**
     * Author:yjh
     * Description:插入风险评分，隶属度，特征值的对应问题数量
     * Create date:2021/3/10 13:46
     * Param:[Float score,List<Float> risks]
     * Return:void
     * Modify[]:,,
     */
    public void setScoreAndRisks(Float score, List<Float> risks, List<Integer> problemNum){
        DecimalFormat df2 = new DecimalFormat("0.00");
        try{
            this.equipScore = Float.parseFloat(df2.format(score));
            this.risk0Point = risks.get(0);
            this.risk1Point = risks.get(1);
            this.risk2Point = risks.get(2);
            this.risk3Point = risks.get(3);
            this.risk4Point = risks.get(4);
            this.risk1Num = problemNum.get(0);
            this.risk2Num = problemNum.get(1);
            this.risk3Num = problemNum.get(2);
            this.risk4Num = problemNum.get(3);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**
     * Author:yjh
     * Description:Test
     * Create date:2021/3/9 22:16
     * Param:[]
     * Return:
     * Modify[]:,,
     */
    public void showAll(){
        System.out.println(getProjectId()+" "+getCheckId()+" "+getProjectName()+" "+getEquipType()
                +" "+getEquipNum()+" "+getEquipScore()+" "+getRisk0Point()+" "+getRisk1Point()+" "+getRisk2Point()
                +" "+getRisk3Point()+" "+getRisk4Point()+" "+getRisk1Num()+" "+getRisk2Num()+" "+getRisk3Num()
                +" "+getRisk4Num());
    }
}